home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
js
/
explorer-src.js
< prev
next >
Wrap
Text File
|
2010-05-19
|
30KB
|
831 lines
function shortName(completeName){
var p=completeName.lastIndexOf('.');
if(p>=0) return completeName.substring(0,p);
return completeName;
}
// Change files layout
function filesLayoutSet(l){
var e=wl.button.enable;
e(dgi('filesLayout_list'));
e(dgi('filesLayout_icons'));
e(dgi('filesLayout_resource'));
wl.button.disable(dgi('filesLayout_'+l));
efTNSize((l==='list')?-1:undefined);
fas(false,"filesLayoutSet",l,0,(W.filesListDisplayed && l!='resource')?'async':'sync');
}
// Search for a file
var searchFileLast='';
var searchFileDialog;
function searchFile(result){
if(result){
searchFileLast=result['input'];
if(result['button']=='ok' && result['input'].length) {
//maskShow(false,false,true);
searchFileDialog.item('icon').src=loadingIconURL;
wl.button.disable(searchFileDialog.item('ok'))
searchFileDialog.item('input').disabled=true;
wl.button.setFunction(searchFileDialog.item('cancel'),'searchFileCancel()');
// Start searching
fas("","searchFile",result['input'],"");
return true; // Don't close form
}
return;
}
searchFileDialog=new dialogBox({'icon':efSearchIcon,'title':efSearchTitle,'text':efSearchText,'input':searchFileLast,'buttons':{'ok':efSearchOkCaption,'cancel':efSearchCancelCaption},'mask':true},'searchFile');
searchFileDialog.show();
searchFileDialog.item('input').focus();
}
function searchFileCancel(){
wl.asr.cancelAll();
searchFileDialog.hide();
fas('','searchFileCancel','','');
}
function searchFileComplete(results,totSize){
fa=results;
totalSize=totSize;
insertFiles();
searchFileDialog.hide();
}
// Remote download
function rdl(inputId) {
var url;
if((url=dgi(inputId).value)=="") return;
dgi(inputId).value="";
fas(url,"rdl","","");
}
// Multiple downloads / playlist
var mIsProcessing=0;
function mAdd(id){
if(mIsProcessing) return;
mProcessing(true);
// Cancel return-to-position animation
if(dd && dd.elements[id]) dd.elements[id].cancelAnim=1;
if(dd && dd.elements['_'+id]) dd.elements['_'+id].cancelAnim=1;
if(dgi(id)) sendData("data3=mAdd&data2="+encodeURIComponent(dgi(id).innerHTML), PHP_SELF, false);
else sendData("data3=mAdd&data2="+id, PHP_SELF, false);
}
// Add into opener window/frame
function mAddOpener(id){
if(parent && winMe.getOpenerId()) parent.frames[parent.dgi(winMe.getOpenerId()+'_if').name].mAdd(id);
else if(opener && opener.mAdd) opener.mAdd(id);
else mAdd(id);
}
// Remove from list
function mSupp(id){
if(mIsProcessing) return;
mProcessing(true);
sendData("data3=mSupp&data2="+encodeURIComponent(dgi(id).innerHTML), PHP_SELF, false);
}
// Remove all
function mSuppAll(){
if(mIsProcessing) return;
mProcessing(true);
sendData("data3=mSuppAll", PHP_SELF, false);
}
// Add all current dir's files
function mAddAll(){
if(mIsProcessing) return;
mProcessing(true);
sendData("data3=mAddAll", PHP_SELF, false);
}
// Start download of all selected files
function mDownload(){
if(mIsProcessing) return;
var prevT=D.forms.comForm.target;
D.forms.comForm.target="_self";
if(dgi("transfersIFrame")) setTimeout("updateTransfersIframe()",1000);
fas('','mDownload',false,false,'sync');
D.forms.comForm.target=prevT;
}
function btDownload(){
if(mIsProcessing) return;
if(dgi("transfersIFrame")) setTimeout("updateTransfersIframe(0)",5000);
D.forms.comForm.target="_self";
fas('','btDownload','','','sync');
}
function mProcessing(isProcessing){
var a=dgi('mdlIcon'), b=dgi('mdlLoadingIcon'),c=dgi('mDlList');
if(isProcessing){
mIsProcessing=1;
if(a) {a.style.display="none"; b.style.display="";}
if(c) c.style.cursor='wait';
}
else{
mIsProcessing=0;
if(a) {b.style.display="none"; a.style.display="";}
if(c) c.style.cursor='auto';
}
}
function mToggleButtons(enabled){
if(enabled){
wl.button.enable("plPlayM3UBt");
if(dgi("plPlayAllBtE") && dgi("plPlayAllBtD")) {dgi("plPlayAllBtE").style.display="inline"; dgi("plPlayAllBtD").style.display="none";}
if(dgi("mDlDownloadE") && dgi("mDlDownloadD")) {dgi("mDlDownloadE").style.display="inline"; dgi("mDlDownloadD").style.display="none";}
if(dgi("btDlDownloadE") && dgi("btDlDownloadD")) {dgi("btDlDownloadE").style.display="inline"; dgi("btDlDownloadD").style.display="none";}
if(dgi("mDlClearE") && dgi("mDlClearD")) {dgi("mDlClearE").style.display="inline";dgi("mDlClearD").style.display="none";}
}
else{
wl.button.disable("plPlayM3UBt");
if(dgi("plPlayAllBtE") && dgi("plPlayAllBtD")) {dgi("plPlayAllBtE").style.display="none"; dgi("plPlayAllBtD").style.display="inline";}
if(dgi("mDlDownloadE") && dgi("mDlDownloadD")) {dgi("mDlDownloadE").style.display="none"; dgi("mDlDownloadD").style.display="inline";}
if(dgi("btDlDownloadE") && dgi("btDlDownloadD")) {dgi("btDlDownloadE").style.display="none"; dgi("btDlDownloadD").style.display="inline";}
if(dgi("mDlClearE") && dgi("mDlClearD")) {dgi("mDlClearE").style.display="none";dgi("mDlClearD").style.display="inline";}
}
}
// Delete a file or a folder
function sup(id) {
if(!dgi(id)) return;
if(!confirm(efCaptGenConfirmSuppress.replace('%1',dgi(id).innerHTML))) return;
fas(dgi(id).innerHTML,"sup","","");
asyncSetPI(1);
}
// Rename a file or folder
function ren(id) {
oldName=dgi(id).innerHTML.replace(/ /g,' ').replace(/&/g,'&');
newName=prompt(efCaptExplorerEnterNewName,oldName);
if ((newName) && (newName!="")) fas(oldName.replace(/&/g,'&'),"ren", newName.replace(/&/g,'&')); else return;
asyncSetPI(1);
}
// Move or copy a file or folder
function moveFile(idSource, idDest, copy){
if(idSource=='mainTree_outer') return;// WA for problem resizing folders treeview
if(idSource==idDest || !dgi(idSource) || !dgi(idDest)) return;
var tn,srcLabel,destLabel,destPath,action;
if(tn=treeNodeChecked(idDest)) {
destPath=tn.getPath();
destLabel=destPath.replace(/\*resourceBasePath\*/,'');
destPath+='/'+dgi(idSource).innerHTML;
}
else{
destLabel=dgi(idDest).innerHTML;
destPath=dgi(idDest).innerHTML+'/'+dgi(idSource).innerHTML
destPath=destPath.replace(/ /g,' ');
}
srcLabel=dgi(idSource).innerHTML.replace(/ /,' ');
destLabel=destLabel.replace(/ /g,' ').replace(/&/g,'&');
if(copy){
if(!confirm(efCaptGenConfirmCopy.replace('%1',srcLabel).replace('%2',destLabel))) return;
action='cpy';
}
else{
if(!confirm(efCaptGenConfirmMove.replace('%1',srcLabel).replace('%2',destLabel))) return;
action='ren';
if(dgi("_"+idSource)) dgi("f"+idSource.substring(2)).style.visibility="none";
else dgi("c"+idSource.substring(2)).style.visibility="none";
// Cancel return-to-position animation
if(dd && dd.elements[idSource]) dd.elements[idSource].cancelAnim=1;
if(dd && dd.elements['_'+idSource]) dd.elements['_'+idSource].cancelAnim=1;
}
fas(dgi(idSource).innerHTML, action, destPath);
asyncSetPI(1);
}
// Create a folder
function newFolder(id) {
newName=prompt(efCaptExplorerEnterFolderName,"");
if ((newName) && (newName!="")) fas(newName,"newFolder", "","");
}
// Sort files
function srt(field, order){
D.forms['comForm'].elements['data1'].value=field;
asyncSetPI(1);
fas(order,"srt","","",(W.filesListDisplayed&&filesListDisplayed!='resource')?'async':undefined);
}
// execute a file on server
function exe(id) {
var now = new Date(); var windowName="exec"+now.getTime();
parameters=prompt(efCaptExplorerEnterParameters,"");
if (parameters==false || parameters) {
W.open("about:blank",windowName, "toolbar=no,location=no,status=yes,scrollbars=no,resizable=no,menuBar=no,width=400,height=200");
D.forms['comForm'].target=windowName;
fas(dgi(id).innerHTML, "exe",parameters,"");
D.forms['comForm'].target='';
}
}
// Update transfers iframe
function updateTransfersIframe(reupdate){
frames["transfersIFrame"].refresh(reupdate);
}
// Download file (id must be "idXXX")
function dl(id){
if(dragCancelOnclick) {dragCancelOnclick=false; return;}
var fileName;
if(dgi(id)) fileName=dgi(id).innerHTML; else fileName=id;
var dlToken="";
for(var i=0;i<D.comForm.elements['data1'].value.length;i++) dlToken+=D.comForm.elements['data1'].value.charCodeAt(i);
for(var i=0;i<fileName.length;i++) dlToken+=fileName.charCodeAt(i);
var targetURL="/dl/dlToken"+dlToken+'/resId'+resId+'/'+D.comForm.elements['data1'].value+'/'+fileName;
D.location.href=targetURL.replace(/#/gi,"*weezoSharp*").replace(/\&/gi,"*weezoAmp*").replace(/\+/gi,"*weezoPlus*").replace(/\%/gi,"*weezoPercent*").replace(/ /gi,"%20");
if(dgi("transfersIFrame")) setTimeout("updateTransfersIframe()",1000);
}
// View file
function view(id,width,height,action) {
if(W.dragCancelOnclick && dragCancelOnclick) {dragCancelOnclick=false; return;}
var forceAsync=false;
var winTitle=((dgi(id))?dgi(id).innerHTML:id);
if(!action) action="view";
// Special: m3u playlist downloaded to browser
if(action=='forceM3U'){
fas(((dgi(id))?dgi(id).innerHTML:id),'view',"forceM3U",false,'sync');
return;
}
// Inline player
if(phpRVarInlinePlayer) {
fas(((dgi(id))?dgi(id).innerHTML:id),action,"firstLoad",width+"x"+height,forceAsync);
D.comForm.target='';
return;
}
// Frameless theme : sync open in same window
if(!winFrames) {D.comForm.target="";forceAsync="sync";}
else if(noPopup && winUseWindows){
if(parent.dgi('viewWindow'+resId) && parent.dgi('viewWindow'+resId).innerHTML!=""){
parent.win("viewWindow"+resId).bringToFront();
}
else{
var w=parent.dd.getWndW();
var h=parent.dd.getWndH();
if(!width) width=Math.min(Math.floor(5*w/6),640);
if(!height) height=Math.min(Math.floor(5*h/6),480);
parent.winOpenLocation("","viewWindow"+resId,"Weezo",winMyId);
with(parent.win("viewWindow"+resId)){
setReloadType('POST');
moveTo(Math.floor((w-width)/2),Math.floor((h-height)/2));
resizeInnerTo(width,height);
show();
bringToFront();
}
}
parent.win("viewWindow"+resId).setCaption(winTitle);
D.comForm.target=parent.dgi('viewWindow'+resId+'_if').name;
}
else{
var w=screen.availWidth;
var h=screen.availHeight;
if(!width) width=Math.floor(2*w/3);
if(!height) height=Math.floor(2*h/3);
W.open("about:blank","viewWindow"+resId, "toolbar=no,location=no,status=yes,resizable=yes,menuBar=no,width="+width+", height="+height+", top="+Math.floor((h-height)/2)+", left="+Math.floor((w-width)/2));
D.comForm.target='viewWindow'+resId;
}
//alert(((dgi(id))?dgi(id).innerHTML:id))
//fas('zza.bmp',action,"firstLoad",width+"x"+height,forceAsync); D.comForm.target='';
fas(((dgi(id))?dgi(id).innerHTML:id),action,"firstLoad",width+"x"+height,forceAsync); D.comForm.target='';
}
// Edit file
function edit(id) {
return view(id,undefined, undefined, "edit");
if(W.dragCancelOnclick && dragCancelOnclick) {dragCancelOnclick=false;return;}
W.open("about:blank","editWindow", "toolbar=no,location=no,status=yes,resizable=yes,menuBar=no,width="+(screen.width/2)+", height="+(screen.height/2)+", top=" + (screen.height/4) + ", left=" + (screen.width/4));
D.forms['comForm'].target='editWindow';
if(dgi(id)) fas(dgi(id).innerHTML,"edit",false,false); else fas(id,"edit",false,false);
D.forms['comForm'].target='';
}
// Display images from-to thumbnail, or change items per page
function goThumbnail(id,async){
if(id==='') return;
id=""+id;
if(id.substr(0,3)=='ipp') fas(id.substr(3),"changeItemsPerPage","","",async); else fas(id,"goThumbnail","","",async)
}
/**
* Display go progress indicator
* set: true to set, false to remove
*/
function asyncSetPI(set){
if(asyncSetPITO) clearTimeout(asyncSetPITO);
if(set){
asyncSetPITO=wl.setTimeout(maskShow,900,1,1,'wait',0,'<img src="/gfx/loading2.gif" alt="">');
if(W.winMe) winMe.setReloading();
}
else {
if(W.winMe) winMe.setLoaded();
maskHide();
}
}
var asyncSetPITO;
// change directory
function go(id) {
if(W.dragCancelOnclick && dragCancelOnclick) {dragCancelOnclick=false; return;}
var res=(id=='..')?fas('..',"go","",""):fas(dgi(id).innerHTML,"go","","");
asyncSetPI(1);
}
/**
* Direct Navigation to an absolute or relative path
* inputId: id of <input> containing relative path OR relative path
* async: true or undefined to async refresh
*/
function goDirect(inputId,async) {
var typedFileName=(dgi(inputId))?dgi(inputId).value:inputId;
if(!typedFileName) typedFileName='.';
if(dgi(inputId)) dgi(inputId).value="";
fas(typedFileName,"goDirect",'','',async);
asyncSetPI(1);
}
// Go back to previous directory
function goBack(){
fas('..',"goBack","","")
asyncSetPI(1);
}
/**
* @desc Insert script used for playlist songs insertion / removal
*
*/
function plAdd(id){
if(mIsProcessing) return;
mProcessing(true);
fas(((dgi(id))?dgi(id).innerHTML:id),'plAdd',false,false);
}
function plSupp(key){
if(mIsProcessing) return;
mProcessing(true);
fas(false,'plSupp',key,false);
}
function plUp(key){
if(mIsProcessing) return;
mProcessing(true);
fas(false,'plUp',key,false);
}
function plDown(key){
if(mIsProcessing) return;
mProcessing(true);
fas(false,'plDown',key,false);
}
function plPlay(id,w,h){var tmp=D.comForm.data1.value;D.comForm.data1.value='';view(id,w,h);D.comForm.data1.value=tmp;}
function plPlayAll(w,h,forcedFormat){
var tmp=D.comForm.data1.value;D.comForm.data1.value='';
if(forcedFormat=='forceM3U')view("*playlist*.m3u",w,h,'forceM3U');
else view("*playlist*.m3u",w,h);
D.comForm.data1.value=tmp;
}
function plToggleShuffle(val){fas(false,'plToggleShuffle',val,'');}
// Mainplaylist
function plRefresh(fa){
buff='';
if(fa.length==0) {
dgi("mDlList").innerHTML='<center style="width:99%;margin-top:'+(dgi("mDlList").offsetHeight/2-10)+'px">'+efCaptExplorerAudioNoSongInPlayList+'</center>';
dgi("mDlList").style.overflow='visible';
return;
}
dgi("mDlList").style.overflow='scroll';
for(var i=0;i<fa.length;){
buff+='<div id="_id'+seqId+'" class="eTC" eH=1 style="width:99%;position:relative" nowrap="nowrap">';
buff+=dgi("plPlayBt").innerHTML.replace(/ITEMID/g,'id'+seqId);
buff+=dgi("plSuppBt").innerHTML.replace(/ITEMID/g,i/2);
buff+=fa[i+1];
buff+='<span id="id'+seqId+'" style="display:none">'+fa[i]+'</span>';
if(fa.length>2){
if(i) buff+='<span style="position:absolute;right:0.5em;" onclick="javascript:plUp('+(i/2)+')">'+efIcoUp+'</span>';
if(i<fa.length-2) buff+='<span style="position:absolute;right:1.8em;cursor:pointer" onclick="javascript:plDown('+(i/2)+')">'+efIcoDown+'</span>';
}
buff+='</div>';
i+=2;
seqId++;
}
dgi("mDlList").innerHTML=buff;
}
/**
* @desc Function called on drop event
* idSource: id of dragged object
* idDest: id of drop target
*/
function dropFunction(idSource, idDest){
if(idDest=="mDlList") {
if(dgi("mDlPlaylist")) plAdd(idSource);
else mAdd(idSource);
return;
}
if(idDest=='actionsPanel_colTD') return;
if(idDest=="previewOuterFrame") {preview.set(idSource); return;}
if(W.moveFile) moveFile(idSource, idDest, mouseEvt && mouseEvt.e && mouseEvt.e.ctrlKey);
}
//return a string containing checked files names
function checkedFiles(){
var i; var fileString="";var fileNameId;
for(i=0;i<D.getElementsByName('cb').length;i++){
if(D.getElementsByName('cb')[i].checked==true) {
fileNameId=D.getElementsByName('cb')[i].id
fileNameId=fileNameId.substring(2,fileNameId.length)
fileString+='f="'+dgi('id'+fileNameId).innerHTML+'" ';
}
}
return fileString;
}
// Comments edition
function saveComments(){
var commentText=dgi('efCommentsTextArea').value.replace(/\n/gi,"<br />"); // "
fas(dgi('efPreviewFileName').innerHTML, "saveComments", commentText,"",true);
}
// Sync/Async thumbnails update monitoring function
function tnUpdt(t,p){
dgi('tnMonitoringDiv').style.display='';
progressSetText('tnProg',t);
progressSetPerc('tnProg',p);
}
/**
* Explorer files list or icons view
*/
var filesListElts=[];
function FilesList(files,layout,nodeId,tnw,curDir){
this.files=files; // List of files (Cf. efFilePropertiesToJSArray) for format
this.dir=curDir; // Current directory, resoure-path relative
this.layout=layout; // Layout type: 'icons', 'list', 'customIcons' or 'resource'
this.nodeId=nodeId; // Id of container node
this.tnw=tnw; // Current thumbnails width
this.nb=files.length; // Nb of files
this.cl=0;
this.selectedId=0;
this.UID=100*Math.random();
this.noTooltip=0;
this.contextMenuExtra; // Function called to modify context menu
// Dynamic drag object creation
this.sDF=function(n,DHTMLOptions){
var p,i=n.id;
if(i.substr(0,1)=='_'){p=i.substr(0,3);i=i.substr(3)} else{p=i.substr(0,2);i=i.substr(2)}
if(dd.elements[p+i]) return;
if(n.style.position!='absolute') n.style.position='relative';
if(DHTMLOptions) dragItem=p+i+DHTMLOptions;
else dragItem=p+i+INERTIA+CURSOR_HAND+ELASTIC+DETACH+PICKDELAY+400;
if(dd.ie) {try{ADD_DHTML(dragItem,1);} catch(err){};} else ADD_DHTML(dragItem,1);
// Add item to created DHTML elements list so it can be removed before next .draw()
filesListElts.push(p+i)
}
// Onload and onerr callbacks
this.lo=function(e,err){
e=e||event;
n=e.currentTarget||e.srcElement;
if(n&&!err) {
var ns=n.nextSibling;
if(ns) {
if(ns.src.indexOf('icoM3U')!=-1||ns.src.indexOf('icoMus')!=-1) ns.src=efOverMus;
else if(ns.src.indexOf('icoVid')!=-1) ns.src=efOverVid;
else removeNode(n.nextSibling);
}
n.style.visibility=''
}
setTimeout('fL.l()',1);
}
this.le=function(e){fL.lo(e,1)}
// Thumbnail onload function
this.l=function(n,err){
while(this.cl<this.nb){
// If image has alt, put it into src and wait for it to be loaded
if(dgi('f'+this.cl) && (n=dgi('f'+this.cl).firstChild.firstChild) && n.alt){
this.cl++;
n.onload=this.lo;
n.onerror=this.le;
n.src=n.alt;
n.alt='';
break;
}
this.cl++;
}
}
// Detect wether right-click is done over an element
this.onrightclick=function(e){
var t=e?e.target:event.srcElement;
var l=10; while(--l>0 && t) {
if(t.id && (t.id=='filesTable'||t.id=='contextMenu'||t.id=='maskDiv')) return false;
t=t.parentNode;
}
return true;
}
/**
* Left click or context menu
*/
this.cm=function(n,e){
var o,f,rc=((e && e.which == 3)||(W.event && event.button == 2)); // right-click
var isDir=(n.id.substr(0,1)=='d'); // right-clicked file is directory
var nid=(n.id.substr(0,3)=='_id')?n.id.substr(3):n.id.substr(1);
var id='id'+nid;
// Left click
if(!rc){
if(o=dd.obj){
if(o.pickTime()>350 || Math.abs(o.x-o.pickX)>10 || Math.abs(o.y-o.pickY)>10) return;
}
if(this.previewOnCM){
if(typeof this.previewOnCM=='function') this.previewOnCM(id);
else if(W.preview) preview.set(id); // If (image) preview function is present, call it
}
if(this.noLeftClickCM) return; // If no left-click context menu, exit
}
var pl=dgi('mDlPlaylist')?1:0; // A playlist drop-box is present (context menu will display "play" instead of "view"
if(isDir && !rc) {go(id);return};
f=this.files[nid];
var cmi=new Array();
if(isDir) {
cmi[0]=ContextMenuItem(false,efCaptOpen,'go(fL.selectedId)',1);
cmi[1]=ContextMenuItem('sep');
}
// Downloadable
if(f[7]){
v=(f[18]=='v'||f[18]=='a'||f[5].indexOf('icoM3U')!=-1)||(f[5].indexOf('icoMus')!=-1)||(f[5].indexOf('icoVid')!=-1);
cmi.push(v?ContextMenuItem(efIcoPlay,efCaptPlay,'view(fL.selectedId)',1):ContextMenuItem(efIcoView,efCaptView,'view(fL.selectedId)',1));
// Download shortcut allowed
if(f[7]==2){
cmi.push(ContextMenuItem('sep'))
cmi.push(ContextMenuItem(efIcoDl,efCaptDl,'dl(fL.selectedId)'))
}
}
if(f[8]||pl) {cmi.push(ContextMenuItem(efIcoMAdd,efCaptMAdd,((pl)?'plAdd':'mAdd')+'(fL.selectedId)')); cmi.push(ContextMenuItem('sep'))}
if(f[6]) cmi.push(ContextMenuItem(efIcoEdit,efCaptEdit,'edit(fL.selectedId)'));
if(f[13]) cmi.push(ContextMenuItem(efIcoRen,efCaptRen,'ren(fL.selectedId)'));
if(f[14]) cmi.push(ContextMenuItem(efIcoExe,efCaptExe,'exe(fL.selectedId)'));
if(f[12]) {cmi.push(ContextMenuItem('sep'));cmi.push(ContextMenuItem(efIcoSup,efCaptSup,'sup(fL.selectedId)'))}
if(this.contextMenuExtra) this.contextMenuExtra(cmi) // If custom preview menu function, pass generated menu to function
this.selectedId='id'+n.id.substr((n.id.substr(0,1)=='f')?1:3);
if(!rc && (cmi.length==(1+(isDir?1:0)))) eval(cmi[0]['action']); // Single item & left click, click-on
else var cm=new ContextMenu(cmi,{'fade':1,'centerFirst':!rc}); // else, show context menu
}
// Tooltip
this.tt=function(n){
if((W.dragInProgress && dragInProgress)) return false;
if(n.tagName=='TD') n=n.parentNode;
id=n.id
this.selectedId='id'+id.substr(1);
fas(dgi('id'+id.substr(1)).innerHTML,'getFileInfo',1,false,'async');
return '<img id="tooltipLoading" src="'+loadingIconURL+'">';
}
/* Mouse (h)over / mouse out icon */
this.mSel=0;
this.mH=function(n){
if(this.mSel&&this.mSel!=n) fL.mO(this.mSel); this.mSel=n;
$(n).e.className().add('itemSel');
tooltipDelay=2000;
if(!this.noTooltip) tooltip(n,fL.tt)
}
this.mO=function(n){$(n).e.className().remove('itemSel')}
/**
* Single thumbnail HTML
*/
this.iconHTML=function(f,i,tnw,tnh){
var bw=Math.max(Math.ceil(tnw/15),5),fsw=tnw+4*bw;fsh=tnh+4*bw+0;
var u='<fieldset class="filesIcon" id="'+((f[1]=='d')?'d':'f')+i+'" onmouseup="fL.cm(this,event)" onmouseout="fL.mO(this)" onmouseover="fL.mH(this)" style="width:'+fsw+'px;padding:0px;overflow:hidden">';
// Image
if(f[15]) {
u+='<div class="img" id="_id'+i+'" style="width:'+(f[16]+2*bw+2)+'px;height:'+(f[17]+2*bw+2)+'px;margin-top:'+(bw+(tnh-f[17])/2)+'px;margin-bottom:'+((tnh-f[17])/2)+'px;margin-left:'+(bw+(tnw-f[16])/2-1)+'" onmousedown="fL.sDF(this)">';
u+='<img alt="'+f[15]+'" style="width:'+f[16]+'px;height:'+f[17]+'px;margin-left:'+bw+'px;margin-top:'+bw+'px;visibility:hidden">';
}
// 32x32 icon
else{
u+='<div id="_id'+i+'" style="position:relative;width:'+(tnw+18)+'px;height:'+(tnh+12)+'px;top:5px;padding:0px;margin:0px" onmousedown="fL.sDF(this)">';
u+='<img style="position:relative;top:'+(4+Math.floor((tnh-32)/2))+';left:'+(Math.floor((tnw+18-32)/2))+'" src="'+((f[1]=='d')?efFolderIconM:f[5])+'">';
}
u+='</div>';
u+='<div class="fIC" id="id'+i+'" style="width:'+fsw+'px">'+f[2]+'</div>';
return u+'</fieldset>';
//+fsh+'/'+tnh+' bw='+bw;
}
/**
* Create layout
*/
this.draw=function(){
var tnw=this.tnw, f,o,u,tnh=Math.floor(tnw*3/4);
// Remove previous DHTML elements from dd.elements
for(o=0;o<filesListElts.length;o++) dd.elements[filesListElts[o]].del();
filesListElts=[];
if(W.filesListBeforeDraw) filesListBeforeDraw(this.files,tnw,tnh);
// Icons layout
if(this.files.length==0) o='<table id="filesTable" style="text-align:center;width:100%;height:95%"><tr><td style="vertical-align:middle;height:10em">'+efCaptNoFile+'</td></tr></table>';
else if(layout=='icons') {
o='<div id="filesTable" style="text-align:left">';
for(var i=0;i<this.files.length;i++){
o+=this.iconHTML(this.files[i],i,tnw,tnh);
}
o+='</div>';
}
// Files layout
else if(layout=='list') {
o='<table id="filesTable" onmousemove="eHover(event)" onmouseout="eHover()" style="text-align:right" cellspacing=0 cellpadding=0 width="100%"><colgroup><col width="20"><col width="*"><col width="40"><col width="40"><col width="40"></colgroup>';
for(var i=0;i<this.files.length;i++){
f=this.files[i];
o+='<tr class="eTC '+((i%2)?'even':'odd')+'" eH=1 id="'+((f[1]=='d')?'d':'f')+i+'" onmouseup="fL.cm(this,event)">';
o+='<td onmouseover="tooltip(this,fL.tt)" class="eTCLeft"><img src="'+((f[1]=='d')?efFolderIcon:f[5])+'" alt="" style="height:16"> </td>'; // Icon
o+='<td style="text-align:left;overflow:hidden"><span id="id'+i+'" onmousedown="fL.sDF(this)" class="mainCapt">'+f[2]+'</span></td>';// Name
o+='<td> '+f[9]+'</td>'; // Size
o+='<td> '+f[10]+'</td>'; // date
o+='<td> '+f[11]+'</td>';
o+='</tr>';
}
o+='</table>'
}
// 'resource' / 'customIcons'
else {
o=filesLayoutResource(files,tnw,tnh);
}
if(!this.nodeId) D.write(o); else dgi(this.nodeId).innerHTML=o;
if(this.layout!='list') for(i=0;i<5;i++) this.l()
if(W.filesListAfterDraw) filesListAfterDraw(this.files,tnw,tnh);
}
}
// Change thumnnails size factor, -1 to disable
function efTNSize(s){
if(!dgi('efTNSize0')) return;
var updt=s!==undefined && s!==-1;
if(s===undefined) s=W.thumbnailsSizeFactor;
var as; if(W.filesListDisplayed&&filesListDisplayed!='resource') as='async';
wl.button.enable(dgi('efTNSize0'),s!==0&&s!=-1);
wl.button.enable(dgi('efTNSize1'),s!==1&&s!=-1);
wl.button.enable(dgi('efTNSize2'),s!==2&&s!=-1);
if(updt) {thumbnailsSizeFactor=s;fas(0,'efTNSize',s,0,as)}
}
/**
* Image Preview Class
*/
function PreviewImage(){
this.imgIndex=0;
this.id='id0';
this.filename='';
this.imgLastWH;
this.next='';
this.prev='';
this.angle=0;
this.fileViewAllowed=1;
this.slideShowActive=0;
this.slideShowTimer=0;
this.lastSet='';
this.commentsEdit; // Comments edit mode, 0/1
this.comments; // Comments
this.ctrlsTO=0;// next/prev photo buttons fade-out timer
this.set=function(id){
if(dd && dd.obj) dd.obj.cancelAnim=1;
if(dragCancelOnclick) {dragCancelOnclick=false;return;}
if(typeof(id)=='object' && id.id) id=id.id;
if(!id) id=this.id;
this.id=id;
var fn=(dgi(id))?dgi(id).innerHTML:id,pOF=dgi('previewOuterFrame'),lS;
lS=((pOF)?pOF.offsetWidth+'/'+pOF.offsetHeight:'0/0')+'/'+fn;
if(lS!=this.lastSet){
if(pOF) {
fas(fn,'preview',pOF.offsetWidth,pOF.offsetHeight,true);
}
else {
fas(fn,'preview',0,0,true);
}
this.lastSet=lS
}
}
this.updateSrc=function(s,w,h){
var i=1-this.imgIndex;
var pOF=dgi('previewOuterFrame'), ePI=dgi('previewImg'+i);
if(!pOF) return;
if(!ePI){
ePI=D.createElement('IMG');
ePI.id='previewImg'+i;
ePI.onclick=function(){preview.view()};
ePI.style.visibility='hidden';
ePI.style.zIndex=1;
pOF.insertBefore(ePI,pOF.firstChild);
}
with(ePI.style){
visibility='hidden';
display='block';
width=w;
height=h;
left=(pOF.offsetWidth-w)/2;
top=(pOF.offsetHeight-h)/2;
}
ePI.onload=function(){preview.switchImages()};
ePI.src=s;
}
this.setFilename=function(f){this.filename=f}
this.setTitle=function(t){var n=dgi('previewTitle');if(n) n.innerHTML=t}
this.commentsSet=function(c){
if(c!==undefined)this.comments=c;
c=this.comments;
if(!dgi('efCommentsFrame')) return;
var i,o='',t=[0,1,-1,0,0,1],l=[0,0,0,1,-1,1];
for(i=5;i>=0;i--) o+='<div style="position:absolute;text-align:center;width:100%;color:#'+((i)?'555':'FFF')+';top:'+t[i]+'px;left:'+l[i]+'px">'+c+'</div>';
dgi('efCommentsFrame').innerHTML=o
dgi('efCommentsTextArea').value=c.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/<br\/>/g,"\n");
}
this.commentsToggle=function(){
var e=this.commentsEdit=1-this.commentsEdit;
dgi('editStartBt').style.display=dgi('efCommentsFrame').style.display=(e)?'none':''
dgi('editStopBt').style.display=dgi('efCommentsForm').style.display=(e)?'':'none'
fas(efEditMode,'toggleComments','','',true);
this.commentsSet();
if(e) dgi('efCommentsTextArea').focus();
}
this.commentsSave=function(){
var c=dgi('efCommentsTextArea').value.replace(/\r\n/g,'<br>');
fas(this.filename,'commentsSave',c,0,'async')
}
this.currentImg=function(){return dgi('previewImg'+this.imgIndex)}
this.switchImages=function(){
if(dgi('previewImg'+this.imgIndex)) fade(dgi('previewImg'+this.imgIndex),1,0);
this.imgIndex=1-this.imgIndex;
fade(dgi('previewImg'+this.imgIndex),0,1);
}
this.frameResized=function(){
var pOF=dgi('previewOuterFrame'),i,lw,lh,r,rr,ePI;
var pOFw=pOF.offsetWidth,pOFh=pOF.offsetHeight,nw,nh;
if(this.imgLastWH==pOFw+pOFh || pOF.style.display=='none' || !pOFw || !pOFh) return;
this.imgLastWH=pOFw+pOFh;
for(i=0;i<2;i++) if(ePI=dgi('previewImg'+i)){
lw=ePI.offsetWidth;
lh=ePI.offsetHeight;
r=lw/lh,rr=pOFw/pOFh;
if(r>rr){nw=pOFw;nh=height=pOFw/r;} else {nh=pOFh;nw=width=pOFh*r}
if(lw*lh) with(ePI.style) {
width=nw;height=nh;
left=(pOFw-nw)/2;top=(pOFh-nh)/2
}
if(i==this.imgIndex && (nw>lw||nh>lh) && ePI.src) this.set();
}
}
this.view=function(id) {if(this.fileViewAllowed) view(id)}
this.goNext=function() {this.set(this.next)}
this.clickNext=function() {setAlpha(dgi('previewNextBt'),1);fade(dgi('previewNextBt'),1,0.7,40);preview.ctrlsTOReset(1);this.goNext()}
this.goPrev=function() {this.set(this.prev)}
this.clickPrev=function() {setAlpha(dgi('previewPrevBt'),1);fade(dgi('previewPrevBt'),1,0.7,40);preview.ctrlsTOReset(1);this.goPrev()}
this.rotateLeft=function(){fas(this.filename,'rotate'+((this.angle>0)?(this.angle-90):270),dgi("previewOuterFrame").offsetWidth,false,true);}
this.rotateRight=function(){fas(this.filename,'rotate'+((this.angle==270)?0:this.angle+90),dgi("previewOuterFrame").offsetWidth,false,true);}
this.dl=function(){dl(this.id)}
this.mAdd=function(){mAdd(this.id)}
this.ctrlsTOReset=function(mi){
if(this.ctrlsTO) clearTimeout(preview.ctrlsTO);
this.ctrlsTO=0;this.ctrlsTO=setTimeout('preview.ctrlsHide()',((mi)?8000:3000))
}
this.ctrlsShow=function(){
wl.fadeTo('previewNextBt',0.7,10);
wl.fadeTo('previewPrevBt',0.7,10);
this.ctrlsTOReset(1);
}
this.ctrlsHide=function(){
if(preview.ctrlsTO) clearTimeout(preview.ctrlsTO); preview.ctrlsTO=0;
wl.fadeTo('previewNextBt',0,60);
wl.fadeTo('previewPrevBt',0,60);
}
this.ctrlsMouseOut=function(){this.ctrlsTOReset(0)}
// Slideshow
this.toggleSlideshow=function(){
this.slideShowActive=1-this.slideShowActive;
dgi('slideShowStartButton').style.display=(this.slideShowActive)?'none':'';
dgi('slideShowStopButton').style.display=(this.slideShowActive)?'':'none';
if(this.slideShowActive==1) this.slideShowTimer = W.setInterval("preview.goNext()",slideShowInterval);
else W.clearInterval(this.slideShowTimer);
}
}
// Prevent backspace key to go back to previous page (instead try goBack function)
wl.blockBackspace();